function shot(arr) {
    arr.sort((a, b) => a[1] - b[1])
    let max = arr[0][1]
    let count = 1;
    for (let i = 0; i < arr.length; i++) {
        if(arr[i][0] > max){
            count++
            max = arr[i][1]
        }
    }
    return count
}

console.log(shot([[10,16],[2,8],[1,6],[7,12]]))
console.log(shot([[1,2],[3,4],[5,6],[7,8]]))